package Java8实战._5_重构_测试_调试._7_3_观察者模式;

import java.util.ArrayList;
import java.util.List;

public class Feed implements Subject{

    private final List<Observer> observerList = new ArrayList<>();

    @Override
    public void registerObserver(Observer observer) {
        this.observerList.add(observer);
    }

    @Override
    public void notifyObservers(String tweet) {
        observerList.forEach(o -> o.notify(tweet));
    }
}









